#include <vector>
#include <unordered_map>
#include <string>

using namespace std;

class Solution {
public:
    vector<string> summaryRanges(vector<int>& nums) {
        vector<string> ret;
        int size = nums.size();
       int i = 0;
       while(i < size)
       {
            int low = i;
            i++;
            while(i<size && nums[i]==nums[i-1]+1)
                i++;
            int high = i-1;

            string tmp;
            tmp += to_string(nums[low]);
            if(low<high)
            {
                tmp+="->";
                tmp += to_string(nums[high]);
            }
            ret.push_back(tmp);
       }
       
       return ret;
        
    }
};
